takingStringsApart
Strings Sandbox MichS Revised

How to Take Strings Apart

Problem
=======

How to  find strings in larger strings.

Solution
========

In the following,  'x' becomes 1, since the 1st character in the string 'str' is 'a'

 function takeApart1(      str,find,x) {
       str  = "abc"
       find = "a"
       x    = index(str, find)
       return x
 }

In the following,  'x' becomes  2, since the 2nd character in the string 'str' is 'b'.

 function takeApart2(    str,find,x) {
	str  = "abc"
	find = "b"
	x    = index(str, find)
        return x
 }

In the following, 'x' equals 3, since the 3rd character in the string 'str' is 'c'.

 function takeApart3(    str,find,x) {
       str  = "abc"
       find = "c"
       x    = index(str, find)
       return x
 }

In the following, 'x' equals 0 (zero), since the string 'in' *does not* contain 'C'.

 function takeApart4(    str,find,x) {
	str  = "abc"
	find = "C"
	x    = index(str, find)
	return x
 }

Author
======

Michael Sanders

   function TakeApart() {
	  print takeApart1() == 1
	  print takeApart2() == 2
	  print takeApart3() == 3
	  print takeApart4() == 0
   }

